package cn.com.zpark.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * @PackageName: cn.com.zpark.filter
 * @ClassName: FilterDemo01
 * @Description:
 * @author: RZS
 * @date: 2021/11/21  15:09
 */
public class FilterDemo01 implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        // 执行过滤器逻辑
        System.out.println("请求经过过滤器doFilter");

        // 放行
        filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
       // 初始化过滤器
        System.out.println("初始化过滤器init");
    }

    @Override
    public void destroy() {
        // 销毁过滤器
        System.out.println("销毁过滤器destroy");
    }
}
